<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body align="center">

<form action="toAdd" method="post" enctype="multipart/form-data" >
    <h2 th:if="${bookId.id==null}">新增</h2>
    <h2 th:if="${bookId.id!=null}">修改</h2>
    <input type="text" name="id" th:value="${bookId.id}" hidden>
    <input type="text" name="imgurl" th:value="${bookId.imgurl}" hidden>
    <table align="center">
        <tr>
            <td>书名:</td>
            <td>
                <input type="text" name="name" th:value="${bookId.getName()}">
            </td>
        </tr>
        <tr>
            <td>价格:</td>
            <td>
                <input type="text" name="price" th:value="${bookId.getPrice()}">
            </td>
        </tr>
        <tr>
            <td>类目:</td>
            <td>
                <input type="text" name="category" th:value="${bookId.category}">
            </td>
        </tr>
        <tr>
            <td>库存:</td>
            <td>
                <input type="text" name="pnum" th:value="${bookId.pnum}">
            </td>
        </tr>
        <tr>
            <td>图片:</td>
            <td>
                <input type="file" name="file" >
            </td>
        </tr>
        <tr>
            <td>说明:</td>
            <td>
                <input type="text" name="description"th:value="${bookId.description}" >
            </td>
        </tr>
        <tr>
            <td>作者:</td>
            <td>
                <input type="text" name="author" th:value="${bookId.author}">
            </td>
        </tr>
        <tr th:if="${bookId.id!=null}">
            <td>已售:</td>
            <td>
                <input type="text" name="sales" th:value="${bookId.sales}">
            </td>
        </tr>
        <tr>
            <td colspan="2">
                <input type="submit" value="提交">
            </td>
        </tr>
    </table>
</form>
</body>
</html>